<template>
  <div class="kecheng-box fadeInUp animated" :style='"while:"+screenWidth+";"'>
    <div class="nav-box">
      <div class="left-box">
        <div class="t-1">
          <div class="top-box">讲师</div>
          <div class="bt-box">
            <div class="bt-img"></div>
            <div class="bt-text">课程讲师</div>
          </div>
        </div>
        <div class="t-1">
          <div class="top-box">直播+点播预习</div>
          <div class="bt-box">
            <div class="bt-img"></div>
            <div class="bt-text">上课方式</div>
          </div>
        </div>
        <div class="t-1">
          <div class="top-box">讲师</div>
          <div class="bt-box">
            <div class="bt-img"></div>
            <div class="bt-text">核心亮点</div>
          </div>
        </div>
        <div class="t-1">
          <div class="top-box">讲师</div>
          <div class="bt-box">
            <div class="bt-img"></div>
            <div class="bt-text">报名咨询讲师QQ</div>
          </div>
        </div>
      </div>
      <div class="right-box">
        <div class="p-left">
          <div class="p-p-top">
            <span>当前价: </span>
            <span class="pirce">￥4999.00</span>
          </div>
          <div class="p-t-b">
            <div class="tag-box">
              <el-tag color="#f4ecfd">一对一解答</el-tag>
              <el-tag color="#f4ecfd">行业交流</el-tag>
            </div>
            <div class="b-text">
              <span>原价: </span>
              <span>￥4999</span>
            </div>
          </div>
        </div>
        <div class="bt-r">
          <div class="bt-t-box">
            <div class="btn-1">咨询客服</div>
            <div class="btn-2">立即购买</div>
          </div>
        </div>
      </div>
    </div>
    <div class="kecheng-body">
      <div class="body-bg" v-for=" (item,index) in kechengList" :key="index">
        <div class="body-title-text">
          <div class="title-l">
            {{index+1}}
          </div>
          <div class="title">
            {{ item.name }}
          </div>
        </div>
        <div class="body-title-forarrList">
          <KechengItem :kechengList="item.children"/>
        </div>
      </div>

    </div>

  </div>
</template>

<script>
import KechengItem from "@/components/kecheng/kecheng-item";
import cbNav from '@/components/CeBianNav/cbNav.vue';

export default {
  name: 'Kecheng',
  components: {KechengItem,cbNav},
  data() {
    return {
      kechengList: [],
      screenWidth: 0,
      timer: true
    };
  },

  mounted() {
    window.addEventListener('resize', this.getHeight)
    const that = this
    window.onresize = () => {
        return (() => {
            window.screenWidth = document.body.clientWidth
            that.screenWidth = window.screenWidth
        })()
    }

  },
  created() {
    window.open('http://andysama.work:8555/', '_blank')
    this.getKecheng()
  },
  methods: {
     getHeight(e) {
      // console.log(e.target.innerHeight) //当前网页高度
      this.screenWidth = parseInt( e.target.innerWidth)/1.5
    },
    getKecheng(){
      this.request.get("/salesCourse/group").then(res =>{
        if(res.code === "200"){
          this.kechengList = res.data
        }else {
          this.$message.error(res.msg)
        }
      })
    }
  },
  watch:{
  
  },
  beforeRouteLeave(to, from, next) {
    // 离开页面时取消监听
    window.removeEventListener('resize', this.getHeight)
    next()
  },
};
</script>

<style lang="less" scoped>
.kecheng-box{
  width: 1200px;
  // height: 280vh;
  margin: 120px auto;
  margin-bottom: 100px;
  
  .nav-box{
    width: 100%;
    height: 100px;
    border-radius: 20px;
    background: white;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left-box{
      width: 48%;
      height: 60%;
      display: flex;
      justify-content: space-around;
      align-items: center;
      .t-1{
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .top-box{
          text-align: center;
          font-size: 18px;
          font-weight: 800;
          color: #9448eb;
        }
        .bt-box{

          .bt-text{
            text-align: center;
            font-size: 10px;
          }
        }
      }

    }
    .right-box{
      width: 50%;
      height: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .p-left{
        width: 60%;
        height: 60%;
        span{
          margin-left: 10px;
        }
        .p-p-top{
          display: flex;
          justify-content: flex-end;
          align-items: center;
          .pirce{
            font-size: 20px;
            font-weight: 800;
            color: red;
          }
        }
        .p-t-b{
          display: flex;
          justify-content: flex-end;
          .tag-box{

            span{
              border: 1px solid #9448ee;
              border-radius: 10px;
              color: #9448ee;
            }
          }
        }
      }
      .bt-r{
        width: 40%;
        height: 60%;
        margin: 0 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        .bt-t-box{
          width: 100%;
          height: 70%;
          display: flex;
          text-align: center;
          .btn-1{
            width: 50%;
            height: 100%;
            line-height: 40px;
            font-weight: 800;
            border-radius: 15px 0 0 15px;
            color: #9448eb;
            background: #f4ecfd;
          }
          .btn-1:hover{
            cursor: pointer
          }
          .btn-2{
            width: 50%;
            height: 100%;
            line-height: 40px;
            font-weight: 800;
            border-radius: 0 15px  15px 0;
            color: white;
            background: #9448eb;
          }
          .btn-2:hover{
            cursor: pointer
          }
        }
      }
    }
  }
  .kecheng-body{
      margin-top: 50px;
    .body-bg{
      margin-bottom: 50px;
      .body-title-text{
        height: 50px;
        margin-left: -15px;
        display: flex;
        text-align: center;
        align-items: center ;
        .title-l{
          width: 30px;
          height: 30px;
          font-weight: 800;
          font-size: 20px;
          line-height: 30px;
          border-radius: 20px;
          background: #1E9FFF;
          color: white;
        }
        .title{

          margin-left: 40px;
          font-weight: 700;
          font-size: 30px;
          color: #1e9fff;
        }
      }
      .body-title-forarrList{
        border-left:2px solid #6f6f6f;
      }

    }
  }
}



</style>